﻿@model S4Store.Models.Decorate.DecorateSaleHistoryModel
@{
    Layout = null;
    ViewBag.Title = "DecorateSaleHistory";

}
<div style="height:100%; overflow:auto">
@Html.Action("ReportBar", "Common", Model.BarModel)
<div style="position:relative; width:100%">
@{
    S4Store.Models.Chart.Line ChartModel1 = new S4Store.Models.Chart.Line();
    ChartModel1.Name = "各车型装潢车销售率对比";
    ChartModel1.YAxis = "比率(%)";
    ChartModel1.Height = 350;

    S4Store.Models.Chart.Line ChartModel2 = new S4Store.Models.Chart.Line();
    ChartModel2.Name = "各车型装潢车销售额对比";
    ChartModel2.YAxis = "金额(万)";
    ChartModel2.Height = 350;
    ChartModel2.IsRate = false;
    
    S4Store.Models.Chart.Line ChartModel3 = new S4Store.Models.Chart.Line();
    ChartModel3.Name = "各车型装潢车单车装潢额对比";
    ChartModel3.YAxis = "金额(万)";
    ChartModel3.Height = 350;
    ChartModel3.IsRate = false;

    foreach (var m in Model.Reports)
    {
        ChartModel1.XAxis.Add(m.Month.ToString("M月"));
        ChartModel2.XAxis.Add(m.Month.ToString("M月"));
        ChartModel3.XAxis.Add(m.Month.ToString("M月"));
    }
    S4Store.Models.Chart.ChartSeries series1_1 = new S4Store.Models.Chart.ChartSeries("装潢率目标");
    S4Store.Models.Chart.ChartSeries series2_1 = new S4Store.Models.Chart.ChartSeries("全车系装潢总额");
    S4Store.Models.Chart.ChartSeries series3_1 = new S4Store.Models.Chart.ChartSeries("全车系单车装潢额");
    ChartModel1.Serieses.Add(series1_1);
    ChartModel2.Serieses.Add(series2_1);
    ChartModel3.Serieses.Add(series3_1);
    foreach (var m in Model.Reports)
    {
        series1_1.Data.Add(m.AllCarReport.CarKpiMonthConfig.DecorateSaleRateTagrt);
        series2_1.Data.Add(m.AllCarReport.DecorateAmout);
        series3_1.Data.Add(m.AllCarReport.DecorateAmoutOfSingCar);
    }
    foreach (var brand in Model.CarBrands)
    {

        S4Store.Models.Chart.ChartSeries series1_N = new S4Store.Models.Chart.ChartSeries(brand.Name+"装潢车销售率");
        S4Store.Models.Chart.ChartSeries series2_N = new S4Store.Models.Chart.ChartSeries(brand.Name + "装潢销售总额");
        S4Store.Models.Chart.ChartSeries series3_N = new S4Store.Models.Chart.ChartSeries(brand.Name + "平均单车装潢额");
        foreach (var m in Model.Reports)
        {
            var r = m.Reports.FirstOrDefault(t => t.CarBrand.Id == brand.Id);
            if (r != null)
            {
                series1_N.Data.Add(r.DecorateXSLV);
                series2_N.Data.Add(r.DecorateAmout);
                series3_N.Data.Add(r.DecorateAmoutOfSingCar);
            }
        }
        ChartModel1.Serieses.Add(series1_N);
        ChartModel2.Serieses.Add(series2_N);
        ChartModel3.Serieses.Add(series3_N);
     }
}

<div class="tabs" currentIndex="0" eventType="click">

		<div class="tabsHeader">
			<div class="tabsHeaderContent">
				<ul>
					<li><a href="javascript:;"><span>各车型装潢车销售率对比</span></a></li>
					<li><a href="javascript:;"><span>各车型装潢车销售额对比</span></a></li>
					<li><a href="javascript:;"><span>各车型装潢车单车装潢额对比</span></a></li>
				</ul>
			</div>
		</div>



		<div class="tabsContent" >
			<div>
                        @Html.Partial("../Chart/Line", ChartModel1)
			</div>
           		 <div>
          		 @Html.Partial("../Chart/Line", ChartModel2)
			</div>
			<div>
          		 @Html.Partial("../Chart/Line", ChartModel3)
			</div>
		</div>


		<div class="tabsFooter">
			<div class="tabsFooterContent"></div>
		</div>

	</div>


</div>
</div>
